#include "VTTPixel.h"

VTTPixel::VTTPixel(unsigned char red, unsigned char green, unsigned char blue)
{
	mColor[0] = red;
	mColor[1] = green;
	mColor[2] = blue;
}

VTTPixel::VTTPixel(float redF, float greenF, float blueF)
{
	redF < 0.0f ? mColor[0] = 0 : (redF > 1.0f ? mColor[0] = 255 : mColor[0] = static_cast<unsigned char>( redF * 255.0f ));
	greenF < 0.0f ? mColor[1] = 0 : (greenF > 1.0f ? mColor[1] = 255 : mColor[1] = static_cast<unsigned char>( greenF * 255.0f ));
	blueF < 0.0f ? mColor[2] = 0 : (blueF > 1.0f ? mColor[2] = 255 : mColor[2] = static_cast<unsigned char>( blueF * 255.0f ));
}

unsigned char VTTPixel::Red( void ) const
{
	return mColor[0];
}

unsigned char VTTPixel::Green( void ) const
{
	return mColor[1];
}

unsigned char VTTPixel::Blue( void ) const
{
	return mColor[2];
}

float VTTPixel::RedF( void ) const
{
	return  mColor[0] / 255.0f;
}

float VTTPixel::GreenF( void ) const
{
	return mColor[1] / 255.0f;
}

float VTTPixel::BlueF( void ) const
{
	return mColor[2] / 255.0f;
}